#!/bin/bash

OPTIND=1
while getopts "u:cls" o ; do # set to next option
	case "$o" in
		c) c=1 ;;
		l) l=1 ;;
		s) s=1 ;;
		u) u=1 ; url=$OPTARG ;;
		*) exit 1 ;;
	esac
done

shift $(($OPTIND - 1))

if [[ -z "$u" || -z "url" ]] ; then
        echo 'Enter a url:'
	read url
fi

if [[ ! -z "$l" && ! -z "$s" ]] ; then
	echo 'You can not shorten and lengthen a url.  Please choose either -l OR -s'
	exit 1
	
fi

if [[ -z "$c" && -z "$l" && -z "$s" ]]; then
        echo 'you must enter at least one argument.'
        exit 1
fi

# run the python script at this point.
# trying to decide where to place the script.  
# this will need to be a location that is available in both OS X and Linux..


#this is for testing
[ ! -z "$c" ] && echo "c on"
[ ! -z "$l" ] && echo "l on"
[ ! -z "$s" ] && echo "s on"

echo "input URL: $url"
